//
//  MBProgressUtil.m
//  EcoDuo
//
//  Created by trendpower on 14/10/31.
//  Copyright (c) 2014年 Felix Zhang. All rights reserved.
//

#import "MBProgressUtil.h"

@implementation MBProgressUtil

+(MBProgressHUD*)showProgressWithMode:(MBProgressHUDMode)mode inView:(UIView *)view withText:(NSString*) text{
    MBProgressHUD *hub = [MBProgressHUD showHUDAddedTo:view animated:YES];
    hub.mode = mode;
    hub.labelText = text;
    [hub show:YES];
    return hub;
}

+ (MBProgressHUD*)showProgressWithMode:(MBProgressHUDMode)mode inView:(UIView *)view withText:(NSString*) text inTime:(float) showTime
{
    MBProgressHUD *hub = [MBProgressHUD showHUDAddedTo:view animated:YES];
    hub.mode = mode;
    hub.minShowTime = showTime;
    hub.labelText = text;
    [hub show:YES];
    return hub;
}

+(void)showToast:(NSString *)text inView:(UIView*) view{
    MBProgressHUD *hub = [MBProgressHUD showHUDAddedTo:view animated:YES];
    hub.mode=MBProgressHUDModeText;
    hub.labelText=text;
    
    [hub showAnimated:YES whileExecutingBlock:^{
        sleep(1);
    } completionBlock:^{
        [hub removeFromSuperview];
    }];
}


@end
